﻿@using zichan.BLL.StatisticsModel
@using zichan.Common;
@model List<CabinetStatisticsModel>
@{
    ViewBag.Title = "机柜统计";
}

@section Pagetitle{
    @AdminCommon.PageTitle("机柜统计", "")
}

<div class="portlet">
    <div class="portlet-title">
        <div class="caption ">
            <i class="fa fa-table"></i>机柜统计
        </div>
    </div>
    <div class="portlet-body">
        <div class="table-container">
            <div class="dataTables_wrapper dataTables_extended_wrapper no-footer">
                <div class="row">
                    <div class="col-sm-12">
                        <div class="table-group-actions pull-left">
                            @using (Html.BeginForm("CabinetIndex", "Statistics", FormMethod.Get, new { @class = "form-inline" }))
                            {
                                <div class="form-group">
                                    @Html.DropDownList("machineRoomId", (SelectList)ViewBag.machineRoomIds, "全部机房", new { @class = "form-control input-small input-sm" })
                                </div>

                                <button class="btn btn-sm yellow table-group-action-submit"><i class="fa fa-check"></i> 搜索</button>
                            }
                        </div>
                    </div>
                </div>
                <div class="row"><div class="col-md-1"><h5>机柜总数:<span style="color:red;">@Model.Select(o => o.CabinetId).Count()</span></h5></div></div>
                <div class="table-scrollable">
                    <table class="table  table-hover">
                        <thead>
                            <tr class="heading">
                                <th>机房名称</th>
                                <th>机柜名称</th>
                                <th>已使用机架数</th>
                                <th>剩余机架数</th>
                                <th>机架总数</th>
                            </tr>
                        </thead>
                        <tbody>
                            @foreach (CabinetStatisticsModel r in Model)
                            {
                                <tr>
                                    <td>@r.MachineRoomName</td>
                                    <td>@r.CabinetName</td>
                                    <td ><a href="/Cabinet/Index?cabinetId=@r.CabinetId&machineRoomId=@ViewBag.machineRoomId">@r.UsedNumber</a></td>
                                    <td><a style="@(r.SubNumber==0?"color:red":"")" href="/Cabinet/Index?cabinetId=@r.CabinetId&machineRoomId=@ViewBag.machineRoomId">@r.SubNumber</a></td>
                                    <td><a href="/Cabinet/Index?cabinetId=@r.CabinetId&machineRoomId=@ViewBag.machineRoomId">@r.TotalNumber</a></td>
                                </tr>
                            }
                        </tbody>
                    </table>
                </div>
                @if (PowerHelp.Check("Excel", "CabinetStatisticsExc"))
                {
                    <div class="row">
                        <div class="col-md-12">
                            <a href="@Url.Action("CabinetStatisticsExc", "Excel", new {machineRoomId=ViewBag.machineRoomId})" class="btn default green">
                                <i class="fa fa-table"></i>
                                <span class="hidden-480">Excel导出报表</span>
                            </a>
                        </div>
                    </div>
                }
            </div>

        </div>
    </div>
</div>

